]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Immediately flip delta in RTL locales
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 15:09:44 +0000 (16:09 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 15:09:44 +0000 (16:09 +0100)
The delta is currently flipped in a shared code path, after appending
the unmodified value to the event history. As a result, the calculated
final velocity for touchpad gestures is wrong in RTL locales.

Fix this by modifying the delta immediately when handling the events,
so that all other code operates on the correct values.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8840
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3967>

js/ui/swipeTracker.js

index 45b23bfaea2eba99721e0e384f3f1d39ca75ae0f..7a0703c26416e07f234b2638d268d61c3414eedf 100644 (file)
@@ -561,10 +561,6 @@ export const SwipeTracker = GObject.registerClass({
         if (this._state !== State.SCROLLING)
             return;
 
-        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
-            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
-            delta = -delta;
-
         this._progress += delta / distance;
 
         this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress));
@@ -575,8 +571,8 @@ export const SwipeTracker = GObject.registerClass({
     _updatePanGesture(panGesture) {
         const deltaVec = panGesture.get_delta_abs();
         const delta = this.orientation === Clutter.Orientation.HORIZONTAL
-            ? -deltaVec.get_x()
-            : -deltaVec.get_y();
+            ? this._getGestureDirFactor() * deltaVec.get_x()
+            : this._getGestureDirFactor() * deltaVec.get_y();
 
         this._updateGesture(delta, this._distance);
     }
@@ -587,6 +583,10 @@ export const SwipeTracker = GObject.registerClass({
             return;
         }
 
+        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
+            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
+            delta = -delta;
+
         this._history.append(time, delta);
         this._updateGesture(delta, distance);
     }